
class Dashboard::OrderContractsController < Dashboard::BaseController

  before_action :find_order

  def create
    attachment = @order.build_order_attachment(image: params[:image])
    attachment.save!

    redirect_to :back
  end

  def destroy
    @product_image = @product.images.find(params[:id])
    if @product_image.destroy
      flash[:notice] = "删除成功"
    else
      flash[:notice] = "删除失败"
    end

    redirect_to :back
  end

  private

  def find_order
    @order = Order.find Order.last.id#params[:order_id]
  end


end
